package com.llg.controller;

import com.llg.model.response.DataResult;
import com.llg.model.response.PageResult;
import com.llg.model.response.ResponseResult;
import com.llg.pojo.InputInter;
import com.llg.service.InputInterService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/inter")
public class InputInterController {

    @Autowired
    private InputInterService service;

    //查所有
    @GetMapping("/findAll")
    public PageResult<InputInter> findAll(){
        return service.findAll();
    }

    //通过id查
    @GetMapping("/{id}")
    public DataResult<InputInter> findById(@PathVariable("id") Integer id){
        return service.findById(id);
    }


    //搜索分页查
    @PostMapping("/findList")
    public PageResult<InputInter> findList(Integer currentPage,Integer pageSize,@RequestBody InputInter inputInter){
        return service.findList(currentPage, pageSize, inputInter);
    }

    //增
    @PostMapping("/add")
    public DataResult<InputInter> add(@RequestBody InputInter inputInter){
        return service.add(inputInter);
    }

    //删
    @GetMapping("/delete/{id}")
    public ResponseResult delete(@PathVariable("id") Integer id){
        return service.delete(id);
    }

    //改
    @PostMapping("/update")
    public ResponseResult update(@RequestBody InputInter inputInter){
        return service.update(inputInter);
    }
}
